package com.demo.util;

import org.springframework.util.DigestUtils;

public class PasswordUtils {

    public static boolean checkPassword(String password, String passwordIn, String salt) {
        String strIn = passwordIn + (salt == null ? "" : salt);
        String degist = DigestUtils.md5DigestAsHex(strIn.getBytes());
        return password.equals(degist);
    }

    public static String makePassword(String passwordIn, String salt) {
        String strIn = passwordIn + (salt == null ? "" : salt);
        return DigestUtils.md5DigestAsHex(strIn.getBytes());
    }

}
